package abstractEntities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import org.hibernate.annotations.GenericGenerator;

import entities.Itemrecord;
import entities.User;

/**
 * AbstractInventory entity provides the base persistence definition of the
 * Inventory entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractInventory implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 8399865740496213781L;
	private Integer idInventory;
	private Integer actSize;
	private Integer maxSize;
	private Set<Itemrecord> itemrecords = new HashSet<Itemrecord>(0);
	private Set<User> users = new HashSet<User>(0);

	// Constructors

	/** default constructor */
	public AbstractInventory() {
	}

	/** minimal constructor */
	public AbstractInventory(Integer actSize, Integer maxSize) {
		this.actSize = actSize;
		this.maxSize = maxSize;
	}

	/** full constructor */
	public AbstractInventory(Integer actSize, Integer maxSize,
			Set<Itemrecord> itemrecords, Set<User> users) {
		this.actSize = actSize;
		this.maxSize = maxSize;
		this.itemrecords = itemrecords;
		this.users = users;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "idInventory", unique = true, nullable = false)
	public Integer getIdInventory() {
		return this.idInventory;
	}

	public void setIdInventory(Integer idInventory) {
		this.idInventory = idInventory;
	}

	@Column(name = "actSize", nullable = false)
	public Integer getActSize() {
		return this.actSize;
	}

	public void setActSize(Integer actSize) {
		this.actSize = actSize;
	}

	@Column(name = "maxSize", nullable = false)
	public Integer getMaxSize() {
		return this.maxSize;
	}

	public void setMaxSize(Integer maxSize) {
		this.maxSize = maxSize;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "inventory")
	public Set<Itemrecord> getItemrecords() {
		return this.itemrecords;
	}

	public void setItemrecords(Set<Itemrecord> itemrecords) {
		this.itemrecords = itemrecords;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "inventory")
	public Set<User> getUsers() {
		return this.users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

}